<template>
    <div class="main">
        <noData v-if="positionlist.length == 0"></noData>
        <div class="showlist"
             v-for="(item,index) in positionlist"
             :key="index"
             @click="positionselect(item)">
            {{item.Name}}
        </div>
        <myMenu></myMenu>

    </div>

</template>

<script>
import { XHeader } from 'vux'
import myMenu from '@/commonComponents/menu'
export default {
    name: 'App',
    data () {
        return {
            positionlist: '',
            positionArea: '',
            userId: '',
            tokenId: '',
            projectId: '',
            userInfo: ''
        }
    },
    components: {
        XHeader,
        myMenu
    },
    created () {
        this.userInfo = JSON.parse(localStorage.userInfo)
        this.userId = this.userInfo.userid
        this.tokenId = this.userInfo.tokenId
        this.projectId = this.userInfo.deptid
        this.hiddlechange()
    },
    methods: {
        hiddlechange () {
            let param = {
                'allowPaging': true,
                'business': 'GetProjectTypeList',
                'pageIndex': 0,
                'pageSize': 20,
                'tokenId': this.tokenId,
                'userId': this.userId
            }
            this.$axiosAjax.getConfigJson(
                param
            ).then(
                (res) => {
                    if (res.data.code == 0) {
                        this.positionlist = res.data.data
                        this.positionlist = [{ Name: '全部', Id: '' }, ...this.positionlist]
                    }
                }
            )
        },
        positionselect (item) {
            // localStorage.positionarea = item.name;
            //   localStorage.positionper = JSON.stringify(item);
            this.$store.state.checkcompany = Object.assign({}, this.$store.state.checkcompany, {
                'projectName': item.Name,
                'ProjectTypeId': item.Id
            })
            // this.$router.back();
            this.$router.go(-1)
            // this.$router.push("/hideRegister")
        }
    }

}
</script>

<style scoped lang="less">
.showlist {
    height: 40px;
    line-height: 40px;
    color: #999;
    font-size: 14px;
    padding: 0 20px;
    border-bottom: 1px solid #ccc;
}
.main {
    background-color: #fff;
}
</style>
